package main

import "fmt"

// 结构体中各种类型属性
type Person3 struct {
	Name  string
	Age   int
	Hobby []string
	map1  map[string]string
}

// 结构体嵌套
type User struct {
	Name     string
	Password string
	Address
}

type Address struct {
	Province string
	City     string
	Street   string
}

func main() {
	//var p Person3
	//p.Name = "张三"
	//p.Age = 18
	//p.Hobby = []string{"吃饭", "睡觉", "打豆豆"}
	//p.map1 = map[string]string{
	//	"address": "中国北京",
	//	"mobile":  "18812312311",
	//}
	//fmt.Printf("%#v", p)

	var u User
	u.Name = "张三"
	u.Password = "123456"
	u.Address = Address{
		Province: "北京",
		City:     "北京",
		Street:   "长安街",
	}

	// Address 为匿名属性时, 才能这么写
	u.City = "上海"
	fmt.Printf("%#v", u)
}
